home *** CD-ROM | disk | FTP | other *** search
- # Jedi Knight MOTHS Cog Script
- #
- # POW_ENERGY.COG
- #
- # POWERUP Script - Energy
- #
- # [YB, CYW, SRS]
- #
- # 01/09/98 [YB] Switched to powerup fast mode for multiplayer
- #
- # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
-
-
- symbols
-
- thing powerup local
- thing player local
-
- int bin=11 local
- sound pickupsnd=nrgpu1.wav local
- sound respawnsnd=Activate01.wav local
- flex amount local
-
- int bin_contents=0 local
- int autoselect_weapon=-1 local
- int oldFlags local
-
- message touched
- message taken
- message respawn
- message timer
-
- end
-
- # ========================================================================================
-
- code
-
- touched:
- player = GetSourceRef();
- amount = GetInv(player, bin);
-
- if (amount < GetInvMax(player, bin))
- {
- TakeItem(GetSenderRef(), -1);
- call taken;
- }
-
- Return;
-
- # ........................................................................................
-
- taken:
- powerup = GetSenderRef();
- player = GetSourceRef();
-
- // Print("Energy Cells");
- jkPrintUNIString(player, bin);
-
- // Do effects.
- PlaySoundLocal(pickupsnd, 1, 0, 0);
- AddDynamicTint(player, 0.0, 0.0, 0.2);
-
- // store the old bin contents
- bin_contents = GetInv(player, bin);
-
- // Increment powerup amount.
- ChangeInv(player, bin, 20.0);
-
- // Check for Auto Reload
- if(GetAutoReload() & 1)
- {
- if(!bin_contents)
- {
- if(!((GetAutoReload() & 2) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
- {
- // Try to autoselect and see if the best weapon is an energy cell weapon
- autoselect_weapon = AutoSelectWeapon(player, 2);
- if((autoselect_weapon == 2) || (autoselect_weapon == 3))
- SelectWeapon(player, autoselect_weapon);
- }
- }
- }
-
- return;
-
- # ........................................................................................
-
- respawn:
- PlaySoundThingLocal(respawnsnd, GetSenderRef(), 0.6, 5.0, 10.0, 0);
- return;
-
- end
-
-
-